package ${package}.${moduleName}.controller;

import com.qigio.api.dto.ResultDTO;
import ${package}.${moduleName}.request.${BeanName}FormReq;
import ${package}.${moduleName}.request.${BeanName}QueryReq;
import ${package}.${moduleName}.response.${BeanName}Rsp;
import ${package}.${moduleName}.service.I${BeanName}Service;
import com.qigio.api.util.Page;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
* ${tableComment}
*
* @author ${author} ${email}
*/
@Api(tags = "${tableComment} ")
@RequiredArgsConstructor
@RestController
@RequestMapping("/douyin/${beanName}")
public class ${BeanName}Controller {

    private final I${BeanName}Service service;

    @GetMapping("/page")
    public ResultDTO<Page<${BeanName}Rsp>> page${BeanName}Rsp(@RequestParam(value = "page", defaultValue = "1") int page, @RequestParam(value = "size", defaultValue = "10") int size, ${BeanName}QueryReq req){
        return ResultDTO.success(service.page${BeanName}Rsp(page, size, req));
    }

    @GetMapping("/list")
    public ResultDTO<List<${BeanName}Rsp>> list${BeanName}Rsp(${BeanName}QueryReq req){
        return ResultDTO.success(service.list${BeanName}Rsp(req));
    }

    @GetMapping
    public ResultDTO<${BeanName}Rsp> get${BeanName}Rsp(${BeanName}QueryReq req){
        return ResultDTO.success(service.get${BeanName}Rsp(req));
    }

    @PostMapping
    public ResultDTO<Boolean> addFormReq(@RequestBody ${BeanName}FormReq req){
        return ResultDTO.success(service.addFormReq(req));
    }

    @PutMapping
    public ResultDTO<Boolean> updateFormReq(@RequestBody ${BeanName}FormReq req){
        return ResultDTO.success(service.updateFormReq(req));
    }

    @DeleteMapping
    public ResultDTO<Boolean> deleteFormReq(${BeanName}FormReq req){
        return ResultDTO.success(service.removeByPrimaryKey(req.getId()));
    }
}
